package com.ljq.method_def;

/**
 * Description:
 * Author:ljq
 * Date:2025-02-15
 * Time:21:50
 */
public class DefMethod {
    public static void main(String[] args) {

        System.out.println(getMax(1,2));
        getEvenNumTotal(10);
    }
    //    求最大值
    public static int getMax(int a ,int b) {


        return a > b ? a : b;
    }


//    求偶数
public static int getEvenNumTotal(int a ) {
    int total=0;

    for (int i = 1; i <= a; i++) {
        if( i % 2 == 0){
            total+=i;
        }

    }
    System.out.println(total);
    return  total;
}

}
